﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data;

namespace SMP.Resource
{
    using SMP.Domain;
    public class Nhom_Mathang_Res : BaseDB
    {
        public DataTable GetAll_Nhom_Mathang()
        {
            return ExecuteQuery(@"EXEC GetAll_Nhom_Mathang ");
        }
        
        public DataTable Get_Mathang_Check_Used_By_Id_Nhom_Mathang(long id_nhom_mathang)
        {
            string sql = @"EXEC Get_Mathang_Check_Used_By_Id_Nhom_Mathang {0}";
            sql = string.Format(sql, id_nhom_mathang);
            return ExecuteQuery(sql);
        }

        public bool Delete_Nhom_Mathang(long id_nhom_mathang)
        {
            string sql = string.Format(@"DELETE FROM tb_nhom_mathang WHERE id_nhom_mathang = {0}", id_nhom_mathang);
            return ExecuteNonQuery(sql) > 0 ? true : false;
        }
        
        public bool Insert_Nhom_Mathang(Nhom_Mathang nhom_mathang)
        {
            string sql = string.Format(@"INSERT INTO tb_nhom_mathang(ten_nhom_mathang) VALUES (N'{0}')", nhom_mathang.Ten_Nhom_Mathang);
            return ExecuteNonQuery(sql) > 0 ? true : false;
        }

        public bool Update_Nhom_Mathang(Nhom_Mathang nhom_mathang)
        {
            string sql = string.Format(@"UPDATE tb_nhom_mathang SET ten_nhom_mathang = N'{0}' ", nhom_mathang.Ten_Nhom_Mathang);
            return ExecuteNonQuery(sql) > 0 ? true : false;
        }






    }
}
